package com.gsp.gspframework.helper;

import com.gsp.gspframework.constant.ConfigConstant;
import com.gsp.gspframework.util.PropsUtil;

import java.util.Properties;

public  final class ConfigHelper {

    private static final Properties CONFIG_PROP = PropsUtil.loadProps(ConfigConstant.CONFIG_FILE);

    public static String getJdbcDriver() {
        return PropsUtil.getString(CONFIG_PROP, ConfigConstant.DRIVER);
    }

    public static String getJdbcUrl() {
        return PropsUtil.getString(CONFIG_PROP, ConfigConstant.URL);
    }

    public static String getJdbcUsername() {
        return PropsUtil.getString(CONFIG_PROP, ConfigConstant.USERNAME);
    }

    public static String getJdbcPassword() {
        return PropsUtil.getString(CONFIG_PROP, ConfigConstant.PASSWORD);
    }

    public static String getAppBasePackage() {
        return PropsUtil.getString(CONFIG_PROP, ConfigConstant.BASE_PACKAGE);
    }

    public static String getAppJspPath() {
        return PropsUtil.getString(CONFIG_PROP, ConfigConstant.JSP_PATH,"/WEB-INF/view/");
    }

    public static String getAppAssetPath() {
        return PropsUtil.getString(CONFIG_PROP, ConfigConstant.ASSET_PATH,"/asset/");
    }

    /**
     * 最大上传大小限制
     * 默认5MB
     * @return
     */
    public static int getAppUploadLimit(){
        return PropsUtil.getInt(CONFIG_PROP,ConfigConstant.APP_UPLOAD_LIMIT,5);
    }


}
